package cn.iocoder.yudao.module.hs.dal.mysql.materialmode;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.hs.controller.admin.materialmode.vo.MaterialModePageReqVO;
import cn.iocoder.yudao.module.hs.dal.dataobject.materialmode.MaterialModeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 机型信息 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface MaterialModeMapper extends BaseMapperX<MaterialModeDO> {

    default PageResult<MaterialModeDO> selectPage(MaterialModePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialModeDO>()
                .likeIfPresent(MaterialModeDO::getModeCode, reqVO.getModeCode())
                .eqIfPresent(MaterialModeDO::getCustomerId, reqVO.getCustomerId())
                .likeIfPresent(MaterialModeDO::getCustomerName, reqVO.getCustomerName())
                .eqIfPresent(MaterialModeDO::getProductionWarehouseId, reqVO.getProductionWarehouseId())
                .likeIfPresent(MaterialModeDO::getProductionWarehouseName, reqVO.getProductionWarehouseName())
                .eqIfPresent(MaterialModeDO::getTripartiteWarehouseId, reqVO.getTripartiteWarehouseId())
                .likeIfPresent(MaterialModeDO::getTripartiteWarehouseName, reqVO.getTripartiteWarehouseName())
                .eqIfPresent(MaterialModeDO::getLandingQc, reqVO.getLandingQc())
                .betweenIfPresent(MaterialModeDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(MaterialModeDO::getPartNumber, reqVO.getPartNumber())
                .likeIfPresent(MaterialModeDO::getPartNumberShort, reqVO.getPartNumberShort())
                .eqIfPresent(MaterialModeDO::getIsDirect, reqVO.getIsDirect())
                .orderByDesc(MaterialModeDO::getId));
    }

}